//
//  XCBaseViewController.m
//  SourceOfNature
//
//  Created by 梁新昌 on 16/3/7.
//  Copyright © 2016年 梁新昌. All rights reserved.
//

#import "XCBaseViewController.h"
#import "XCSingleBottumView.h"
#import "OnlineAVplay.h"
@interface XCBaseViewController ()


@end

@implementation XCBaseViewController

- (void)dealloc {
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    self.color = [UIColor colorWithRed:0.2095 green:0.8778 blue:0.9941 alpha:1.0];
//    self.navigationController.navigationBar.barTintColor = self.color;

    [super dealloc];
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    if ([OnlineAVplay shareAVPlayer].isPlay) {
      
        [XCSingleBottumView shareBottomViewBuild].hidden = NO;
    } else {
        [XCSingleBottumView shareBottomViewBuild].hidden = YES;
        

    }
    
    if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"nightPath"] isEqualToString:@"0"]) {
        self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Image-backGroundPic1"]];
    } else {
        self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Image-backpic2"]];
    }

    NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
    [center addObserver:self selector:@selector(receiveNotifition:) name:@"day" object:nil];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationController.navigationBar.translucent = NO;

}

-(void)receiveNotifition:(NSNotification *)message {

    if ([@"1" isEqualToString:message.object]) {
        self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Image-backpic2"]];

    }else if ([@"0" isEqualToString:message.object]) {
        self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"Image-backGroundPic1"]];

    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}



@end
